<script>
var xmlDoc;
loadXML();

/*
 *Original Author:
 *Contributor(s): Derin Phelps
 *Description: Loads the XML document into a variable
 */
function loadXML() {
   xmlDoc=document.implementation.createDocument("","",null);
   xmlDoc.onload = getmessage;
   xmlDoc.load("CalendarFeed.xml");
}

/*
 *Original Author:
 *Contributor(s): Derin Phelps, Steven Gleason
 *Description: Parses the XML document by tag names
 */
function getmessage() {
   //This is supposed to parse out all of the <name> tags in an XML document.
   var calendars = new Array();
   calendars[0] = new Array();
   calendars[1] = new Array();
 
   for (i=0; i<xmlDoc.getElementsByTagName("name").length; i++) {
      //alert("length is " + xmlDoc.getElementsByTagName("name").length + " and i is " + i);
      calendars[0][i] = xmlDoc.getElementsByTagName("name")[i].childNodes[0].nodeValue;
      calendars[1][i] = xmlDoc.getElementsByTagName("id")[i].childNodes[0].nodeValue;
      document.write(calendars[0][i] + "<br>");
      document.write(calendars[1][i] + "<br><br>");
   }
   
   return calendars;
}
</script>
